package edu.mse.camel.client.session.perspectives;

import org.eclipse.ui.IPageLayout;
import org.eclipse.ui.IPerspectiveFactory;
import org.eclipse.ui.IFolderLayout;

import com.cea.papyrus.core.IPapyrusUIConstants;
import com.cea.papyrus.core.ui.wizards.CreateModelFromFileWizard;
import com.cea.papyrus.core.ui.wizards.CreateModelLibraryWizard;
import com.cea.papyrus.core.ui.wizards.CreateModelWizard;
import com.cea.papyrus.core.ui.wizards.CreateProfileWizard;



public class CamelPerspective implements IPerspectiveFactory {

	
	
	public void createInitialLayout(IPageLayout layout) {
		defineActions(layout);
		defineLayout(layout);
	}
	
	public void defineActions(IPageLayout layout) {
		// Add "new wizards".
		layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.project");
        layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");//$NON-NLS-1$
		layout.addNewWizardShortcut(CreateModelWizard.WIZARD_ID);
		layout.addNewWizardShortcut(CreateProfileWizard.WIZARD_ID);
		layout.addNewWizardShortcut(CreateModelFromFileWizard.WIZARD_ID);
		layout.addNewWizardShortcut(CreateModelLibraryWizard.WIZARD_ID);
		
		// Add "show views".
		layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);
		layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
		layout.addShowViewShortcut(IPageLayout.ID_PROP_SHEET);
		layout.addShowViewShortcut(IPapyrusUIConstants.BIRDVIEW_ID);
		// layout.addShowViewShortcut("org.eclipse.pde.runtime.LogView");
		
		layout.addActionSet("org.eclipse.debug.ui.launchActionSet");
		
		// add perspectives
		layout.addPerspectiveShortcut("org.eclipse.ui.resourcePerspective");
		layout.addPerspectiveShortcut("org.eclipse.jdt.ui.JavaPerspective");
	}

	/**
	 * Defines the layout of the perspective (where and which views are available).
	 * 
	 * @param layout the page layout
	 * 
	 * @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPageLayout)
	 */
	public void defineLayout(IPageLayout layout) {
		// Editors are placed for free.
		String editorArea = layout.getEditorArea();

	
		
		IFolderLayout left_bottom3 = layout.createFolder("left", IPageLayout.LEFT, (float) 0.30, editorArea);
		left_bottom3.addView("edu.mse.camel.client.posterboard.ui.outline");
		
		
		
		IFolderLayout left = layout.createFolder("left_middle_under", IPageLayout.BOTTOM, (float) 0.30, "left");
		left.addView(IPageLayout.ID_RES_NAV);

		// place outline under the navigator
		IFolderLayout left_middle = layout.createFolder("left_under", IPageLayout.BOTTOM, (float) 0.30, "left_middle_under");
		left_middle.addView(IPageLayout.ID_OUTLINE);
		
		// Place birdview under the navigator
		IFolderLayout left_bottom = layout.createFolder("left_under", IPageLayout.BOTTOM, (float) 0.70, "left_middle_under");
		left_bottom.addView(IPapyrusUIConstants.BIRDVIEW_ID);
		

//		IFolderLayout bottom = layout.createFolder("under", IPageLayout.BOTTOM, (float) 0.70, editorArea);
//		bottom.addView(IPageLayout.ID_PROP_SHEET);
			
		layout.addView("edu.mse.camel.client.session.camel", IPageLayout.BOTTOM, 0.50f, "left_under");
		// Place navigator to the left of editor area.	
		
		layout.addView("edu.mse.camel.client.chat.views.ChatView", IPageLayout.BOTTOM, 0.75f, layout.getEditorArea());
		

	    layout.getViewLayout("edu.mse.camel.client.session.camel").setCloseable(true);
	    layout.getViewLayout("edu.mse.camel.client.session.camel").setMoveable(true);
	    
	    layout.getViewLayout("edu.mse.camel.client.chat.views.ChatView").setCloseable(true);
	    layout.getViewLayout("edu.mse.camel.client.chat.views.ChatView").setMoveable(true);
		
		
	}
}